cmake_minimum_required(VERSION 3.10)

set(PROJECT_NAME ukui-perf-controller)
set(PROJECT_VERSION "0.1")

project(${PROJECT_NAME} VERSION ${PROJECT_VERSION} LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "x86|i686|i386|amd64|x86_64|arm|aarch64|riscv64")
    message(FATAL_ERROR "此项目不支持 ${CMAKE_SYSTEM_PROCESSOR} 架构！")
endif()

message(STATUS "在 ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR} 架构上构建 ${PROJECT_NAME}")

find_package(Qt5 COMPONENTS Widgets LinguistTools REQUIRED)

set(TS_FILES ukui-perf-controller_zh_CN.ts)


add_executable(${PROJECT_NAME} 
  src/main.cpp
  src/controllerwindow.cpp
  src/cpucontroller.cpp
  src/fancontroller.cpp
  src/batterycontroller.cpp
  src/curveeditor.cpp
  src/thermalcontroller.cpp
  include/controllerwindow.h
  include/cpucontroller.h
  include/fancontroller.h
  include/batterycontroller.h
  include/curveeditor.h
  include/thermalcontroller.h
  ${TS_FILES}
)

set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(${PROJECT_NAME} PRIVATE ${INCLUDE_DIR})


target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Widgets)

qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})

install(TARGETS ${PROJECT_NAME} DESTINATION bin)
